// 创建一个闭包    
(function($) {    
  // 插件的定义    
  $.fn.dateformatLi = function(options) {    
   // debug(this);    
     
    var opts = $.extend({}, $.fn.dateformatLi.defaults, options);    
       
    return this.each(function() {    
      $this = $(this);//为了不让this搞混淆所以设置一个变量，改变量为当前li   
      
      var o = $.meta ? $.extend({}, opts, $this.data()) : opts;    
       $this.css({    
        //backgroundColor: o.background,    
        color: o.foreground    
      });    

			var len=$this.text();
			
			if(len.length==10){
				len=parseInt(len)*1000;
			}else{
				len=parseInt(len);
			}
			
			var date = new Date(len); //日期对象
				var now = "";
				now = date.getFullYear()+"-"; //读英文就行了
				var month=date.getMonth()+1;
				if(month<10){
					month="0"+month;
				}
				now = now + month+"-";//取月的时候取的是当前月-1如果想取当前月+1就可以了
				
				var day=date.getDate();
				if(day<10){
					day="0"+day;
				}
				now = now + day+" ";
			/**
				var h=date.getHours();
				if(h<10){
					h="0"+h;
				}
				now = now + h+":";
				var m=date.getMinutes();
				if(m<10){
					m="0"+m;
				}
				now = now + m+":";
				var s;
				s=date.getSeconds();
				if(s<10){
					s="0"+s;
				}
				now = now + s+"";
			    */
      var markup = now;    
      
      markup = $.fn.dateformatLi.format(markup);    
      $this.html(now);    
    });    
  };    
 
  function debug($obj) {    
    if (window.console && window.console.log)    
      window.console.log('hilight selection count: ' + $obj.size());    
  };    
  
  $.fn.dateformatLi.format = function(txt) {    
    return '<strong>' + txt + '</strong>';    
  };    
  
  $.fn.dateformatLi.defaults = {    
    foreground: 'red'    
    //,background: 'yellow'    
  };    
// 闭包结束    
})(jQuery);     